package screens;


import com.alee.laf.panel.WebPanel;

import controller.App;
import controller.Post;
import controller.Query;
import view.PostList;

import javax.swing.BoxLayout;
import java.util.ArrayList;

public class HomeFeedScreen extends WebPanel {
    private static final long serialVersionUID = 1L;

    private PostList postList;

    /**
     * Shows the 'news' feed for the currently logged in user.
     */
    public HomeFeedScreen() {
        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        this.setOpaque(false);

        // create the view list
        PostList postList = new PostList(Query.getNewsFeed(App.getCurrentUser().userId));

        // sets the target id to the currently logged in user.
        postList.targetID = App.getCurrentUser().userId;

        // show
        this.add(postList);
    }
}
